<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑商品</title>
 <!-- <link rel="stylesheet" href="https://cdn.zhsmjxc.com/CDN/Static-webapp/jsmin/style.css?version=5.7.0.201901051730" type="text/css">-->
<!-- <link rel="stylesheet" href="https://cdn.zhsmjxc.com/CDN/Static-webapp/jsmin/javascript/validator/jquery.validator.css" />
 <script type="text/javascript" src="https://cdn.zhsmjxc.com/CDN/UCenter-webapp/js/product/product.js?version=5.7.0.201901051730"></script>
    <script src="https://cdn.zhsmjxc.com/CDN/UCenter-webapp/js/product/number.js?version=5.7.0.201901051730"></script>-->
    <script type="text/javascript" src="http://www.sz886.com/js/jquery-1.9.1.min.js"></script>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/h-ui/css/H-ui.min.css" />
    <script src="/js/layer/layer.js" charset="utf-8"></script>
    <script src="/js/jquery/jquery.min.js"></script>
</head>
<body>
<div class="container" id="app">
    <form id="addCommdityForm">
    <br/>
       <div style="width: auto;height: auto">
             <table>
                 <tr>
                     <td>
                         <button type="button" id="UpdateBtn" class="btn btn-success">修改</button>
                     </td>
                     <td>
                         <button type="button" id="cancelBtnn" class="btn btn-default">取消</button>
                     </td>
                 </tr>
             </table>
         </div>
        <hr style="height:1px;background-color: #2E2D3C"/>
           <span style="font-size: 16px">基本信息</span>
            <hr style="height:1px;background-color: #2E2D3C"/>
        <b><span style="font-size: 14px">条形码 </span></b>&nbsp;&nbsp;&nbsp;<input style="text-align: center"  type="text" name="tiaoxingma" id="tiaoxingma" th:value="${commodityListid.clScan}" placeholder="选填，扫描或录入条形码"><br><br>
            <span class="c-red">*</span><b><span style="font-size: 14px">编号 </span></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input style="text-align: center" type="text" th:value="${commodityListid.clNumber}" name="bianhao" id="bianhao"><br><br>
            <span class="c-red">*</span><b><span style="font-size: 14px">名称</span></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input style="text-align: center" type="text" name="mingcheng" id="mingcheng"  th:value="${commodityListid.clName}"><br><br>
        <input type="hidden" id="ids" th:value="${commodityListid.id}">
<!--        <b><span style="font-size: 14px">分类 </span></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input style="text-align: center" type="text" name="fenlei" id="fenlei" th:value="${commclass.ccDefault}"><br><br>-->
        分类 &nbsp;&nbsp;&nbsp;
        <select id="comclass" name="comclass" class="select"  style="width: 100px">
        </select>
        <span class="c-red">*</span><b><span style="font-size: 14px">单位</span></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input style="text-align: center" type="text" name="danwei" id="sdanwei"  th:value="${commodityListid.clUnit}"><br><br>
        <b><span style="font-size: 14px">规格</span></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input style="text-align: center" type="text" id="guige" name="guige" th:value="${commodityListid.clSpec}"><br><br>
        <tr class="free">
            <td id="multPropertiesTd">
                <input type="checkbox" id="propertyid" name="propertyname" onclick="enableProperty(this)"><b>多属性支持</b>
            </td>
        </tr>
            <div class="height10"></div>
        <div id="multPropertyDiv" style="display:none">
          <span style="font-size: 14px"><b>品&nbsp;&nbsp;&nbsp;牌</b></span>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select id="pinpai" name="pinpai" style="width: 200px">
            <option></option>
        </select><br><br>
            <span style="font-size: 14px"><b>产&nbsp;&nbsp;&nbsp;地</b></span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select id="chandi" name="chandi" style="width: 200px">
            <option></option>
        </select><br>
            <span style="font-size: 14px"><b>自定义属性1</b></span>&nbsp;&nbsp;&nbsp;<select id="zidingyione" name="zidingyione" style="width: 200px">
            <option></option>
        </select><br>
            <span style="font-size: 14px"><b> 自定义属性2</b></span>&nbsp;&nbsp;&nbsp;<select id="zidingyitwo" name="zidingyitwo" style="width: 200px">
            <option></option>
        </select><br>
            <span style="font-size: 14px"><b> 自定义属性3</b></span> &nbsp;&nbsp;&nbsp;<select id="zidingyithree" name="zidingyithree" style="width: 200px">
            <option></option>
        </select><br>
        </div>
        <div class="formTitle" style="position: static !important;display: block">
            <span style="font-size: 18px"><b>价格管理</b></span>
            <hr style="height:1px;background-color: #2E2D3C"/>
            <table  border="2" align="center">
                <thead>
                <tr>
                    <th width="100" height="50" rowspan="2" style="text-align: center"><span style="font-size: 14px"><b> 价格类别</b></span></th>
                    <th width="100" height="50"></th>
                    <th width="600" height="50" style="text-align: center"><span style="font-size: 14px"><b> 价格</b></span></th>
                </tr>
                </thead>
                <tr>
                    <td width="300" height="50" rowspan="3" style="text-align: center"><span style="font-size: 14px"><b> 销售</b></span></td>
                    <td width="100" height="50" style="text-align: center"><span style="font-size: 14px"><b> 零售价</b></span></td>
                    <td width="600" height="50" style="text-align: center"><span style="font-size: 14px"><b> <input type="text" id="comlingshoujia" style="text-align: center" th:value="${commodityListid.clTagPrise}"></b></span></td>

                </tr>
                <tr>
                    <td width="100" height="50" style="text-align: center"><span style="font-size: 14px"><b> 最低零售价</b></span></td>
                    <td width="600" height="50" style="text-align: center"><span style="font-size: 14px"><b> <input type="text" id="comzuilingshoujia" style="text-align: center" th:value="${commodityListid.clMinLingPrice}"></b></span></td>
                </tr>
                <tr>
                    <td width="100" height="50" style="text-align: center"><span style="font-size: 14px"><b> 批发价</b></span></td>
                    <td width="600" height="50" style="text-align: center"><span style="font-size: 14px"><b> <input type="text" id="compifajia" style="text-align: center" th:value="${commodityListid.clWhoPrice}"></b></span></td>
                </tr>
                <tr>
                    <td width="100" height="50" style="text-align: center"><span style="font-size: 14px"><b> 进货</b></span></td>
                    <td width="100" height="50" style="text-align: center"><span style="font-size: 14px"><b> 参考进货价</b></span></td>
                    <td width="600" height="50" style="text-align: center"><span style="font-size: 14px"><b> <input type="text" id="cankaojinhuojia" style="text-align: center" th:value="${commodityListid.clPurPrice}"></b></span></td>
                </tr>
            </table>
        </div>
        <hr>
        <div class="formTitle" style="position: static !important;">
            <span style="font-size: 18px"><b> 库存预警</b></span>
            <div class="fr font12" >
                <td>
                    <input class="free" id="kucunyujing" name="" type="checkbox" value="" onclick="enableMultiUnit(this)">&nbsp;&nbsp;
                    <label class="free" for="kucunyujing">所有仓库预警值相同</label>&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
            </div>
            <hr style="height:1px;background-color: #2E2D3C"/>
        </div>
     <div  id="kucunlaing" style="display: none" >
         <span style="font-size: 14px;text-align: center"><b> 最低库存量</b></span>&nbsp;&nbsp;&nbsp;<input type="text" id="zuidikucun" name="zuidikucun" th:value="${commodityListid.clMinStock}" ><br><br>
         <span style="font-size: 14px;text-align: center"><b> 最高库存量</b></span>&nbsp;&nbsp;&nbsp;<input type="text" id="zuigaokucun" name="zuigaokucun" th:value="${commodityListid.clMAxStock}">
        </div>
<div id="cangku" style="display: block" >
    <table border="1px black solid" align="center">
        <tr style="width: auto;height: auto">
            <td width="300" height="50" style="text-align: center"><span style="font-size: 14px"><b> 仓库</b></span></td>
            <td width="300" height="50" style="text-align: center" ><span style="font-size: 14px"><b> 最低库存量</b></span></td>
            <td width="300" height="50" style="text-align: center"><span style="font-size: 14px"><b> 最高库存量</b></span></td>
        </tr>
        <tr>
            <!--<td width="300" height="50" style="text-align: center"><span style="font-size: 14px"><b> <input type="text" id="whwmName" name="whwmName" th:value="${whManagement.wmName}"></b></span></td>-->
            <td width="300" height="50" style="text-align: center"><span style="font-size: 14px"><b> <select id="warehouse" name="warehouse" class="select"  style="width: 100px"></select> </b></span></td>

            <td height="50" style="text-align: center"><span style="font-size: 14px"><b> <input type="text" id="comzuidikucun"  name="czuidikc" style="text-align: center" th:value="${commodityListid.clMinStock}"> </b></span></td>
            <td height="50" style="text-align: center"><span style="font-size: 14px"><b> <input type="text"  id="comzuigaokucun" name="czuigaok" style="text-align: center" th:value="${commodityListid.clMAxStock}"></b></span></td>
        </tr>
    </table>
</div>
<hr>
        <div class="formTitle"><b><span style="font-size: 18px">其他</span></b></div>
        <table width="100%" border="0" cellspacing="0" cellpadding="8">
            <tr>
                <td align="right" class="font14" valign="top"><b><span style="font-size: 18px">备注</span></b>&nbsp;&nbsp;&nbsp;</td>
                <td>
                    <textarea id="productremark" name="productremark"  rows="4" cols="150"  style="height: 40px;" class="inputText wf95" maxlength="500"></textarea>
                </td>
            </tr>
        </table>
    </form>
</div>
<script>
    var updatecommodity=function () {
        var clid=$("#comclass").find("option:selected").val();
        var wmid=$("#warehouse").find("option:selected").val();
        $.ajax({
            type:"post",
            dataType:"json",
            url:"/basicdata/commodity-list/updateComm",
            data:{
                id:$("#ids").val(),
                tiaoxingma: $("#tiaoxingma").val(),
                bianhao:$("#bianhao").val(),
                mingcheng:$("#mingcheng").val(),
                fenlei:clid,
                wmid:wmid,
                danwei:$("#sdanwei").val(),
                guige:$("#guige").val(),
                cankaojinhuo:$("#cankaojinhuojia").val(),
                pifajia:$("#compifajia").val(),
                lingshoujia:$("#comlingshoujia").val(),
                comzuilingshoujia:$("#comzuilingshoujia").val(),
                comzuidikucun:$("#comzuidikucun").val(),
                comzuigaokucun:$("#comzuigaokucun").val(),

            },
            success:function (msg) {
                $("#cancelBtnn").click();
            }
        });
    }
   $('#UpdateBtn').on('click',function () {
       updatecommodity();
    });
  $('#cancelBtnn').click(function () {
        var index=parent.layer.getFrameIndex(window.name);
        parent.getCommdityPageList();
        parent.layer.close(index);
    });
</script>
<script  type="text/javascript">
    /**
     * 实现select的滚动条的script
     * @param that
     */
    window.selectFocus = function(that) {
        $(that).attr("size", 5);
    };
    window.selectClick = function(that) {
        $(that).parent().removeAttr("size");
        $(that).parent().blur();
        $(that).parent().children("[selected='selected']").removeAttr("selected");
        $(that).attr("selected", "");
    };
    /*属性设置的script
    * */
    function enableProperty(obj){
        var checks=document.getElementById("multPropertyDiv");
        if (obj.checked){
            checks.style.display="block";
        } else{
            checks.style.display="none";
        }
    }
/*   仓库管理*/
    function enableMultiUnit(obj){
        var cangku=document.getElementById("cangku");
        var kucunlaing=document.getElementById("kucunlaing");
        if (obj.checked){
            cangku.style.display="none";
            kucunlaing.style.display="block";
        }else{
            cangku.style.display="block";
            kucunlaing.style.display="none";
        }
    }
    //商品分类
    var getCommclassList = function() {
        $.ajax({
            type : "POST",
            dataType : "json",
            url : "/basicdata/commclass/queryList",
            success:function(msg) {
                var html="<option value=''>请选择</option>";
                for(var i=0;i<msg.commclass.length;i++){
                    html += "<option value= '"+msg.commclass[i].id+"'>"+msg.commclass[i].ccDefault+"</option>";
                }
                $("#comclass").html('').append(html);
            }
        });
    }
    getCommclassList();
    /*仓库分类*/
    var getWarehouseList = function() {
        $.ajax({
            type : "POST",
            dataType : "json",
            url : "/basicdata/warehouse-management/selectware",
            success:function(msg) {
                var html="<option value=''>请选择</option>";
                for(var i=0;i<msg.warelist.length;i++){
                    html += "<option value= '"+msg.warelist[i].id+"'>"+msg.warelist[i].wmName+"</option>";
                }
                $("#warehouse").html('').append(html);
            }
        });
    }
    getWarehouseList();
</script>
</body>
</html>